﻿using SF.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SF.Ucenter.mycenterusers
{
    public partial class rankinglist : System.Web.UI.Page
    {
        Model.sf_user_info userInfo;
        string appWhere;
        public string liststr;
        BLL.sf_user_info userBll = new BLL.sf_user_info();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                /*验证用户是否登录*/
                if (Session[DTKeys.SESSION_ADMIN_INFO] == null)
                {
                    Response.Redirect("index.aspx");
                }
                userInfo = Session[DTKeys.SESSION_ADMIN_INFO] as Model.sf_user_info;
                appWhere = Utils.getWhereByInfo(userInfo.busnieseNum, userInfo.appNum, userInfo.templatesNum);
                BindData();
            }
        }
        //绑定榜单数据
        public void BindData()
        {
            List<Model.sf_user_info> lists = userBll.getTopList(appWhere);
            for (int i = 0; i < lists.Count; i++)
            {
                if (i <= 100)
                {
                    liststr += i < 3 ? "<div class='item topthree'>" : "<div class='item'>";
                    liststr += "<div class='ranking fl'>" + (i + 1) + "</div><div class='itemtitle fl' style='padding-left:5%;'>" + lists[i].nickName + "</div><span class='fl'>" + lists[i].city + "</span><div class='salesnum fl'>" + lists[i].province + "</div><div class='clearfl'></div></div>";
                }
            }
        }
    }
}